<div ng-controller="EntryController">
    <div ng-show="!entry&&!notFound&&!noAccess">
        <div class="col-md-12 text-center" style="margin-top: 50px; color: #AAA; font-size: 25px">
            <i class="fa fa-2x fa-gear fa-spin"></i> <br>Loading Contents
        </div>
    </div>

    <div ng-show="!entry&&notFound">
        <div class="col-md-12 text-center" style="margin-top: 50px; color: #AAA; font-size: 25px">
            <i class="fa fa-3x fa-warning" style="color: darkred"></i> <br> Specified entry not found
        </div>
    </div>

    <div ng-show="noAccess">
        <div class="col-md-12 text-center" style="margin-top: 50px; color: #AAA; font-size: 25px">
            <i class="fa fa-3x fa-ban" style="color: darkred"></i> <br> No read permission for entry
        </div>
    </div>

    <div ng-if="entry" style="margin-bottom: 60px">
        <div class="entry_general_header_td" style="height: 60px;">
            <div class="col-md-10">
                <i ng-if="context" ng-click="backTo()"
                   class="pull-left fa fa-arrow-circle-left entry_go_back cursor_pointer" title="Back">
                </i>

                <h4>
                    <span ng-if="entry.visible!=='OK'">
                    <small class="label " ng-class="{
                    'label-danger':entry.visible=='DELETED',
                    'label-info':entry.visible=='TRANSFERRED',
                    'label-warning':entry.visible=='PENDING' || entry.visible=='DRAFT'}"
                           style="font-size: 9px; position: relative; top: -4px">{{entry.visible}}
                    </small>
                        &nbsp;</span><strong style="color: #888;">{{entry.type}}</strong>
                    <strong>{{entry.name}}</strong>&nbsp;
                    <span ng-show="entry.canEdit">
                        <span uib-dropdown uib-tooltip="Link to another entry">
                            <i uib-dropdown-toggle class="fa fa-fw fa-link opacity_hover font-80em"
                               style="color: #3a6aad;"></i>
                            <!--ng-click="addLink(entry)"-->
                              <ul class="uib-dropdown-menu" aria-labelledby="simple-dropdown">
                                  <li><a href ng-click="addLink(entry, 'PARENT')" class="font-80em"><i
                                          class="fa fa-level-up"></i> Add Parent</a></li>
                                  <li><a href ng-click="addLink(entry, 'CHILD')" class="font-80em"><i
                                          class="fa fa-level-down"></i> Add Child</a></li>
                              </ul>
                        </span>
                        <span uib-tooltip="Clone this entry">
                            <i class="opacity_hover fa fa-fw fa-clone font-80em" ng-click="createCopyOfEntry()"></i>
                            </span>
                    </span>

                    <span ng-if="entry.publicRead">&nbsp;
                        <small style="font-size: 12px; position: relative; top: -4px"
                               uib-tooltip="Available on web of registries"
                               tooltip-trigger="mouseenter"
                               class="label label-info cursor_default"><i class="fa fa-globe"></i>
                            Public
                        </small>
                    </span>
                    <span ng-repeat="parent in entry.parents">
                    &nbsp;<a ng-href="entry/{{parent.id}}" uib-tooltip="{{parent.name}}"
                             tooltip-trigger="mouseenter"
                             style="font-size: 12px; color: white; position: relative; top: -4px"
                             class="label cursor_pointer "
                             ng-class="{'label-default':parent.visible=='OK',
                             'label-warning': parent.visible=='PENDING' || parent.visible == 'DRAFT',
                             'label-info':parent.visible=='TRANSFERRED',
                             'label-danger': parent.visible=='DELETED'}">
                        {{parent.type | capitalize}} <i class="fa fa-level-up"></i></a>
                    </span>
                    <br>
                    <small class="font-65em">{{entry.creationTime | date:'medium'}} <span
                            style="color: #ccc; width: 1px">&nbsp;|&nbsp;</span> <a
                            ng-href="profile/{{entry.ownerId}}">{{entry.owner}}</a></small>
                </h4>
            </div>

            <div class="col-md-2" style="margin-top: 15px; white-space: nowrap" ng-if="context">
                <button type="button" class="btn btn-link outline-none" ng-disabled="context.offset===0"
                        ng-click="prevEntryInContext()">
                    <i class="fa fa-arrow-left context_nav_pager"></i></button>
                <strong class="font-90em">{{context.offset+1 | number}} / {{context.available | number}}</strong>
                <button type="button" class="btn btn-link outline-none"
                        ng-disabled="context.offset==context.available-1"
                        ng-click="nextEntryInContext()">
                    <i class="fa fa-arrow-right context_nav_pager"></i></button>
            </div>
        </div>

        <table width="100%">
            <tr>
                <td style="vertical-align: top">
                    <ng-include src="selection"></ng-include>
                </td>
                <td style="width: 25px">&nbsp;</td>
                <td style="width: 170px; vertical-align: top">
                    <table cellpadding="0" cellspacing="0" class="entry_detail_submenu pull-right">
                        <tr ng-repeat="subMenu in subDetails"
                            ng-if="(subMenu.isPrivileged&&entry.ownerEmail===user.email) || !subMenu.isPrivileged || user.isAdmin">
                            <td ng-class="{selected:subMenu.selected}" ng-click="showSelection($index)">
                                <i class="fa {{subMenu.icon}}"></i> &nbsp;{{subMenu.display}}
                                <span ng-if="subMenu.countName" style="float: right; color: #999;">{{entryStatistics[(subMenu.countName)] || 0}}</span>
                            </td>
                        </tr>
                    </table>

                    <div class="pad_top pull-right">
                        <ice-entry-attachment></ice-entry-attachment>
                    </div>

                    <div class="pad_top pull-right" ng-if="entry.canEdit">
                        <ice-entry-permission entry='entry'></ice-entry-permission>
                    </div>

                    <div class="pad_top pull-right" ng-if="entry.canEdit">
                        <ice-entry-folders entry="entry"></ice-entry-folders>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>